<?php
class libcookie {
    private $cookie_data = array();
    public function __set($name,$value) {
        $this->cookie_data[$name] = new libcookie_value();
        $this->cookie_data[$name]->name = $name;
    }
    public function __call($name,$arg=null) {
        if(!isset($this->cookie_data[$name])) {
            $this->cookie_data[$name] = new libcookie_value($name);
        }
        return $this->cookie_data[$name];
    }
    public function __isset($name) {
        return isset($_COOKIE[$name]);
    }
    public function __get($name) {
        if(isset($_COOKIE[$name])) {
            return $_COOKIE[$name];
        }
        return null;
    }
}
class libcookie_value {
    public $value = '';
    private $name = '';
    public $expire = '';
    public $path = '/';
    public $domain = '';
    public $secure = '';
    public $httponly = '';
    public function __construct($name) {
        $this->name = $name;
    }
    public function set() {
        setcookie($this->name,$this->value,$this->expire,$this->path,$this->domain,$this->secure,$this->httponly);
    }
}
